
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

using Swaf.Call;
	
namespace Swaf.BizRule
{
	/// <summary>
	/// Defines the interface used by <c>RuleManager</c> to enqueue execution of
	/// business rules to be executed through the impelementation of this interface.</summary>
	/// <author>mdenman</author>
	public interface IRuleQueue
	{
		/// <overloaded>Calls to this method indicate that the specified business rule needs to be executed.</overloaded>
		/// <summary>
		/// </summary>
		/// <param name="info"></param>
		/// <param name="app"></param>
		/// <param name="context"></param>
		/// <param name="ruleParams"></param>
		/// <param name="executeNowIfWorker"></param>
		/// <returns></returns>
		IRuleGroup enqueue(IRuleInfo ruleInfo, ICallResults callInfo, IRuleContext context, IRuleGroup group, object ruleParams, ref bool executeNowIfWorker);

		/// <summary>
		/// This method allows a callback object/method to be provided so that after the work completes, the
		/// callback object/method will be called.
		/// </summary>
		/// <param name="info"></param>
		/// <param name="app"></param>
		/// <param name="context"></param>
		/// <param name="callback"></param>
		/// <param name="callbackMethod"></param>
		/// <param name="ruleParams"></param>
		/// <returns></returns>
		IRuleGroup enqueue(IRuleInfo ruleInfo, ICallResults callInfo, IRuleContext context, IRuleGroup group,
			ICall callback, object ruleParams);

		void  stop();

		uint ElementsInQueue{get;}

		IRuleMonitor Monitor{get;set;}

		uint WorkerCount {get;set;}

		IRunningRule CurrentThreadRunningRule{get;}
	}
}